﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Web.Script.Serialization;

using Model = AzureGames.Model.Board;

namespace AzureGames.Domain.Models
{
    public class GameBoard
    {
        public GameBoard(Model.GameDefinition game, Model.Board board, List<GamePlayer> players)
        {
            ID = board.ID;
            GameDefinitionID = board.GameDefinitionID;
            Value = board.Value;
            GamePlayers = players;
            State = board.State.ToString();
            Properties = board.Properties;
            JavascriptFiles = game.JavascriptFiles;
            CSSFiles = game.CSSFiles;
            Resources = game.Media;
            HTML = game.HTML;

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            GameState = serializer.Serialize(board);
        }

        public Guid ID { get; set; }
        public int GameDefinitionID { get; set; }
        public long Value { get; set; }
        public List<GamePlayer> GamePlayers { get; set; }
        public string State { get; set; }
        public List<string> Properties { get; set; }
        public List<Guid> JavascriptFiles { get; set; }
        public List<Guid> CSSFiles { get; set; }
        public List<Guid> Resources { get; set; }
        public string HTML { get; set; }
        public string GameState { get; set; }
    }
}
